@extends('layouts.backend')
@section('title')
    Tags列表
@endsection
@section('modal')
    <div class="modal inmodal" id="tag" tabindex="-1" role="dialog"  aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated fadeIn">
                <div class="modal-header">
                    <h4 class="modal-title"> 添加Tag</h4>
                </div>
                <form role="form" action="{{route('backend.tag.store')}}" method="post">
                <div class="modal-body">
                    <div class="row">

                            @csrf
                            <div class="form-group"><label>Tag名称</label> <input type="text" name="tag" placeholder="Tag name" class="form-control"></div>

                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">添加</button>
                </div>
                </form>
            </div>
        </div>
    </div>
@endsection
@section('body')
    <div class="row">
        <div class="ibox">
            <div class="ibox-title">
                <h5>Tags列表</h5>
            </div>
            <div class="ibox-content">
                <div class="row">

                    <div class="col-md-6">
                        <form role="form" class="form-inline" method="get">
                            <div class="form-group">
                                <input type="text" placeholder="Enter Keyword " value="{{request('keyword', '')}}" name="keyword" id="keyword" class="form-control">

                            </div>
                            <button class="btn btn-primary" type="submit">搜索</button>
                            <a href="{{ route('backend.tag.index') }}" class="btn btn-warning">重置</a>
                            <a data-toggle="modal" data-target="#tag" class="btn btn-primary m-md">添加Tag</a>
                        </form>
                    </div>

                </div>
                <table class="table">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>名称</th>
                        <th>文章数</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @forelse($tags as $tag)
                        <tr>
                            <td>{{$tag->id}}</td>
                            <td>{{$tag->tag}}</td>

                            <td>0</td>
                            <td>{{$tag->created_at}}</td>
                            <td>
                                <a href="{{route('backend.tag.edit', $tag)}}" class="btn btn-warning btn-sm">编辑</a>
                                @include('components.backend.destroy', ['url' => route('backend.tag.destroy', $tag)])
                            </td>
                        </tr>
                    @empty
                        <tr>
                            <td class="text-center" colspan="7">暂无记录</td>
                        </tr>
                    @endforelse
                    </tbody>
                </table>
            </div>
            <div class="ibox-footer">
                {{$tags->render()}}
            </div>
        </div>
    </div>
@endsection
